#ifndef _LISTLIST_H_
#define _LISTLIST_H_

/*  
typedef int elemtype;

type struct Node 
{

	elemtype data;
	Node *next;

}Node,*linklist;


linklist *init_list(linklist *L);
status destroy_list(linklist *L);
status clear_list(linklist *L);
status list_empty(linklist *L);
status list_length(linklist *L);
status get_elem(linklist *L, int i, elemtype *e);
status LocateElem(linklist *L, elemtype e, compare());
status prior_elem(linklist *L, elemtype cur_e, elemtype &pre_e);
status next_elem(linklist *L, elemtype cur_e, elemtype &next_e);
status list_insert(linklist *L, int i, elemtype e);
status list_delete(linklist *L, int i, elemtype e);
status list_traverse(linklist *L, visit());

*/

typedef struct lnode
{
    elemtype data;
    struct lnode *next;
}*link, *position;

typedef struct 
{
    link head, tail;  //first end 
    int len;     //length
}linklist;


linklist *init_list();
status destroy_list(linklist *L);
status clear_list(linklist *L);
status insfirst(link *h, link *s); //h is head node , insert s in first node before
status delfirst(link *h, link *q); // del first node;
status append(linklist *L, link *s); //append *s(and end) in L end;
status remove(linklist *L, link *q); // remove end node is tail , and change tail node;
status ins_before(linklist *L, link *p, link *s); //insert s before p node,ang change p->new;
status in_after(linklist *L, link *p, link *s);
status set_curelem(link *p, elemtype e);// updata p->data = e;
elemtype get_curelem(link *p); //return p->data;
status list_empty(linklist *L);
int list_length(linklist *L);
link *get_head(linklist *L);
link *get_last(linklist *L);
link *prior_pos(linklist *L, link *p); //return prior p node*;
link *next_pos(linklist *L, link *p); //return next p node*;else return null;

status locate_pos(linklist *L, int i, link *p);

link *locate_elem(linklist *L, elemtype e ,status (*compare)(elemtype, elemtype));// first e = elemtype node*
status list_traverse(linklist *L, status(*visit)());




#endif
